package com.shoe.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shoe.mapper.ShoeEvaluateMapper;
import com.shoe.pojo.ShoeDepot;
import com.shoe.pojo.ShoeEvaluate;
import com.shoe.service.ShoeEvaluateService;
import com.shoe.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoeEvaluateServiceImpl implements ShoeEvaluateService {

    @Autowired
    ShoeEvaluateMapper shoeEvaluateMapper;
    @Override
    public ResponseResult selectAll(int currPage, int pageSize) {
        PageHelper.startPage(currPage,pageSize);
        List<ShoeEvaluate> list = shoeEvaluateMapper.selectByExample(null);
        PageInfo<ShoeEvaluate> pageInfo = new PageInfo<>(list);
        pageInfo.setNavigatePages(10);
        ResponseResult responseResult = new ResponseResult();
        responseResult.setData(pageInfo);
        return responseResult;
    }

    @Override
    public int addEvaluate(ShoeEvaluate record) {
        return  shoeEvaluateMapper.insertSelective(record);
    }

    @Override
    public int deleteById(Long evaluateId) {
        return shoeEvaluateMapper.deleteByPrimaryKey(evaluateId);
    }
}
